06. Managing Packages

Managing Packages

Install Packages

Once you have Anaconda installed, managing packages is fairly straightforward. To install a package, type the following command in your terminal.

conda install PACKAGE_NAME

For example, to install numpy, type conda install numpy.

You can install multiple packages at the same time. For example, the command below will install all three packages simultaneously.

conda install numpy scipy pandas

It's also possible to specify which version of a package you want by adding the version number such as conda install numpy=1.10.

Conda also automatically installs dependencies for you. For example scipy uses and requires numpy. If you install just scipy (conda install scipy), Conda will also install numpy if it isn't already installed.

Remove Packages

Most of the commands are pretty intuitive. To uninstall, use

conda remove PACKAGE_NAME

Update Packages

To update a package, use

conda update package_name


If you want to update all packages in an environment, which is often useful, use conda update --all. And finally, to list installed packages, it's conda list which you've seen before.

Search a Package to Install

If you don't know the exact name of the package you're looking for, you can try searching with conda search *SEARCH_TERM*. For example, I know I want to install Beautiful Soup, but I'm not sure of the exact package name. So, I try conda search *beautifulsoup*. Note that your shell might expand the wildcard * before running the conda command. To fix this, wrap the search string in single or double quotes like conda search '*beautifulsoup*'.

It returns a list of the Beautiful Soup packages available with the appropriate package name, beautifulsoup4.

Additional Resource

Refer to the Conda Command reference guide to know more about conda commands, and compare them with pip and virtualenv commands.

Multiple Choice Question - Which of these commands would you use to install the packages numpy and pandas with conda? (More than one might be correct - select all that apply.)

SOLUTION:
  • `conda install pandas`
  • `conda install numpy pandas`

Single Choice Question

What are the prerequisites to run the command conda install package_name that will install a package?

SOLUTION: The system must have any version of Python and `conda` package manager already installed on it (using either Miniconda or Anaconda).